﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib  uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加商品</title>
    <link rel="stylesheet" href="<%=basePath %>web/css/from.css">
    <link rel="stylesheet" href="<%=basePath %>web/themes/default/easyui.css">
    <link rel="stylesheet" href="<%=basePath %>web/themes/icon.css">
    <script src="<%=basePath %>web/js/jquery.min.js"></script>
    <script src="<%=basePath %>web/js/jquery.easyui.min.js"></script>
    <script src="<%=basePath %>web/js/easyui-lang-zh_CN.js"></script>
    <script>
        function loadSupplier() {
            $("#list").dialog({
                title: '供应商列表',
                width: 905,
                height: 400,
                closed: false,
                cache: false,
                modal: true
            });

        }
        function closeDg(name) {
            $("#supplierName").val(name);
            $("#list").dialog("close");
        }
        function loadPart() {
            $("#partList").dialog({
                title: '选择配件',
                width: 1000,
                height: 400,
                closed: false,
                cache: false,
                modal: true,
           })
        }
        function closePart() {
            $("#partList").dialog("close");
        }
         function total(col){
        	var rows=$("#datatable").datagrid('getRows');
        	var total=0;
        	for(var i=0;i<rows.length;i++){
        		total+=parseFloat(rows[i][col]);
        	}
        	return total;
        }
        $(function(){
        var code=$("#outcode").val()
        	$("#datatable").datagrid({
        		fit:true,
        		rownumbers:true,
        		url:'/kxmanage/osb/getpart?code='+code,
        		 columns:[[
                    {field:'ordercode',title:'销售单号',width:150},
                    {field:'code',title:'配件号',width:150},
                    {field:'partName',title:'配件名称',width:173},
                    {field:'partBrand',title:'配件品牌',width:80},
                    {field:'partNo',title:'配件型号',width:100},
                    {field:'amount',title:'数量',width:80},
                    {field:'avg',title:'单价(￥)',width:80},
                    {field:'price',title:'金额(￥)',width:80},
                    {field:'tuihuo',title:'所属仓库',width:78,formatter:function(value,row,index){
                    	if(row.avg==null){
                    		return null;
                    	}
                    	var str="主仓库"
                    	return str;
                    	}}, 
                    
                    {field:'memo',title:'备注',width:100}, 
                   	
                ]],
                onClickRow:function(index,data){
                	$(this).datagrid('unselectRow',index);
                },
                onLoadSuccess:function(){
               
                	$("#datatable").datagrid('appendRow',{
                	'partBrand':"合计",
                	'amount':total('amount'),
                	'price':total('price')
                	})
                }
        	})
        
        })
        function loadadd(){
         	parent.addTabs("出库单","goods/addOuttorageBill.jsp");
        }
        function closeself(){
         	parent.closeTabs("出库单");
        }
    </script>
    <style>
         body {
            font-size:12px;
            padding:10px
        }
        .l-table-edit {
           border-collapse:collapse;
           boreder-spacing:0
        }
        .l-table-edit-td {
            padding:4px;
            font-size:12px;
             border:#84a0c4 1px solid
        }
        
    </style>


</head>
<body>
<!--  未审核
<form name="form"  id="form" action="" method="post">
    <table cellpadding="0"  cellspacing="0" class="l-table-edit" style="width:100%"  >
        <tr >
            <td width="17%"  align="right" class="l-table-edit-td">出库单号：</td>
            <td width="27%" align="left" class="l-table-edit-td"><input class="easyui-textbox" name="code" type="text" id="code" value="${oB.code}" size="30" maxlength="100" ltype="text" /></td>
            <td width="13%"  align="right" class="l-table-edit-td">出库日期：</td>
            <td width="43%" align="left" class="l-table-edit-td"><input class="easyui-datebox" name="outstorageDate"  id="addDate" value='<fmt:formatDate value="${oB.outstorageDate }" pattern="yyyy-MM-dd"/>' style="width:168px"/></td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">
                <a href="javascript:loadSupplier()">客户名称</a>：
            </td>
            <td align="left" class="l-table-edit-td">
                <input class="easyui-textbox" name="customName" type="text" id="supplierName"  value="${oB.customName }"  maxlength="100" ltype="text"  style="width:239px"/>
            <td width="13%" align="right" class="l-table-edit-td">联系人员：</td>
            <td align="left" class="l-table-edit-td">
                <input class="easyui-textbox" name="linkname" type="text" id="linkname" value="${oB.linkname }" maxlength="30" ltype="text" /></td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话：</td>
            <td align="left" class="l-table-edit-td"><input class="easyui-textbox" name="phone"  type="text" id="phone" value="${oB.phone }" size="30" maxlength="50" ltype="text" /></td>
            <td width="17%" align="right" class="l-table-edit-td">出库方式：</td>
            <td align="left" class="l-table-edit-td">
				<select  name="outstorageType">
					<option value="1" <c:if test="${oB.outstorageType==1}">selected</c:if>>销售出库</option>
					<option value="2" <c:if test="${oB.outstorageType==2}">selected</c:if>>其他出库</option>
				</select>
			</td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">传&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;真：</td>
            <td align="left" class="l-table-edit-td"><input class="easyui-textbox" type="text" id="fax" value="${oB.fax }" size="30" maxlength="50" ltype="text" /></td>
            <td width="17%" align="right" class="l-table-edit-td">是否开票：</td>
            <td align="left" class="l-table-edit-td">
				<input type="radio" name="kp" checked/>是<input type="radio" name="kp"/>否
			</td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：</td>
            <td align="left" class="l-table-edit-td"><input class="easyui-textbox" type="text" id="type" value="${oB.address }" size="30" maxlength="50" ltype="text" /></td>
            <td width="17%" align="right" class="l-table-edit-td">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：</td>
            <td align="left" class="l-table-edit-td"><input class="easyui-textbox" name="memo" type="text"  class="l-table-edit" id="memo" value="${oB.memo }" maxlength="50"  ltype="text" style="width:168px"/>
            <input type="hidden" value="1" name="payStatus">
            </td>
        </tr>
        
    </table>
</form>
<br>
<input  type="button" value="新   增" style="width:60px">
<input  type="button" value="销售单" style="width:60px">
<a href="javascript:loadPart()"><input  type="button" value="添加配件" style="width:60px"></a>
<input  type="button" value="保存" style="width:60px">
<input  type="button" value="审核" style="width:60px">
<input  type="button" value="关闭" style="width:60px">
<div id="list"  style="display: none">
    <iframe src='<%=basePath %>web/goods/company.jsp' frameborder='0'style='width: 100%;height: 100%'></iframe>
</div>
<div id="partList"  style="display: none">
    <iframe src='<%=basePath %>web/goods/addPart.jsp' frameborder='0'style='width: 100%;height: 100%'></iframe>
</div>
-->
<form name="form"  id="form" action="" method="post">
<input type="hidden" id="outcode" value="${oB.code}">
    <table cellpadding="0"  cellspacing="0" class="l-table-edit" style="width:100%"  >
        <tr >
            <td width="17%"  align="right" class="l-table-edit-td">出库单号：</td>
            <td width="27%" align="left" class="l-table-edit-td"><input class="easyui-textbox" name="code" type="text" id="code" value="${oB.code}" size="30" maxlength="100" ltype="text" readonly="readonly"/></td>
            <td width="13%"  align="right" class="l-table-edit-td">出库日期：</td>
            <td width="43%" align="left" class="l-table-edit-td"><input class="easyui-datetimebox" name="outstorageDate"  id="addDate" value='<fmt:formatDate value="${oB.outstorageDate }" pattern="yyyy-MM-dd hh:mm:ss" />' style="width:168px" readonly="readonly"/></td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">
                <a href="javascript:;">客户名称</a>：
            </td>
            <td align="left" class="l-table-edit-td">
                <input class="easyui-textbox" name="customName" type="text" id="supplierName"  value="${oB.customName }"  maxlength="100" ltype="text"  style="width:239px" readonly="readonly"/>
            <td width="13%" align="right" class="l-table-edit-td">联系人员：</td>
            <td align="left" class="l-table-edit-td">
                <input class="easyui-textbox" name="linkname" type="text" id="linkname" value="${oB.linkname }" maxlength="30" ltype="text" readonly="readonly"/></td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">电&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;话：</td>
            <td align="left" class="l-table-edit-td"><input class="easyui-textbox" name="phone"  type="text" id="phone" value="${oB.phone }" size="30" maxlength="50" ltype="text" readonly="readonly"/></td>
            <td width="17%" align="right" class="l-table-edit-td">出库方式：</td>
            <td align="left" class="l-table-edit-td">
				<select  name="outstorageType" disabled="disabled">
					<option value="1" <c:if test="${oB.outstorageType==1}">selected</c:if>>销售出库</option>
					<option value="2" <c:if test="${oB.outstorageType==2}">selected</c:if>>其他出库</option>
				</select>
			</td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">传&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;真：</td>
            <td align="left" class="l-table-edit-td"><input class="easyui-textbox" type="text" id="fax" value="${oB.fax }" size="30" maxlength="50" ltype="text" readonly="readonly"/></td>
            <td width="17%" align="right" class="l-table-edit-td">是否开票：</td>
            <td align="left" class="l-table-edit-td">
				<input type="radio" name="kp" checked disabled="disabled"/>是<input type="radio" name="kp" disabled="disabled"/>否
			</td>
        </tr>
        <tr>
            <td width="17%" align="right" class="l-table-edit-td">地&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;址：</td>
            <td align="left" class="l-table-edit-td"><input class="easyui-textbox" type="text" id="type" value="${oB.address }" size="30" maxlength="50" ltype="text" readonly="readonly"/></td>
            <td width="17%" align="right" class="l-table-edit-td">备&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;注：</td>
            <td align="left" class="l-table-edit-td"><input class="easyui-textbox" name="memo" type="text"  class="l-table-edit" id="memo" value="${oB.memo }" maxlength="50"  ltype="text" style="width:168px" readonly="readonly"/>
            <input type="hidden" value="1" name="payStatus">
            </td>
        </tr>
    </table>
</form>
<br>
<a href="javascript:loadadd()"><input  type="button" value="新   增" style="width:60px"></a>
<a href="javascript:closeself()"><input  type="button" value="关闭" style="width:60px"></a>
<br/>
<div class="easyui-datagrid" id="datatable"></div>
<div id="list"  style="display: none">
    <iframe src='<%=basePath %>web/goods/company.jsp' frameborder='0'style='width: 100%;height: 100%'></iframe>
</div>
<div id="partList"  style="display: none">
    <iframe src='<%=basePath %>web/goods/addPart.jsp' frameborder='0'style='width: 100%;height: 100%'></iframe>
</div>
</body>
</html>